//
//  Book.m
//  17-SandBox
//
//  Created by 曹曹 on 16/8/5.
//  Copyright © 2016年 曹曹. All rights reserved.
//

#import "Book.h"

@implementation Book

// 取值,
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    self = [super init];
    if (self) {
        _bookName = [aDecoder decodeObjectForKey:@"bookName"];
        _bookType = [aDecoder decodeObjectForKey:@"bookType"];
        _bookPrice = [aDecoder decodeObjectForKey:@"bookPrice"];
        _bookAuthor = [aDecoder decodeObjectForKey:@"bookAuthor"];
        _bookAddress = [aDecoder decodeObjectForKey:@"bookAddress"];
        _bookData = [aDecoder decodeObjectForKey:@"bookData"];
    }
    return self;
}

// 赋值, 存储
- (void)encodeWithCoder:(NSCoder *)aCoder {
    [aCoder encodeObject:_bookName forKey:@"bookName"];
    [aCoder encodeObject:_bookType forKey:@"bookType"];
    [aCoder encodeObject:_bookPrice forKey:@"bookPrice"];
    [aCoder encodeObject:_bookAuthor forKey:@"bookAuthor"];
    [aCoder encodeObject:_bookAddress forKey:@"bookAddress"];
    [aCoder encodeObject:_bookData forKey:@"bookData"];
}
@end
